Ext.define('Portal.PainelLogin', {
	extend: 'Ext.form.Panel',
	xtype: 'login-form',
	frame:true,
	width: 300,
	
	url: 'logar',
	
	defaultType: 'textfield',
	items: [{
		allowBlank: false,
		fieldLabel: 'Usuario',
		name: 'login',
		id: 'login',
		emptyText: 'nome de usuario'
	}, {
		allowBlank: false,
		fieldLabel: 'Senha',
		name: 'senha',
		id: 'senha',
		emptyText: 'senha',
		inputType: 'password'
	},{
		xtype: 'button',
		width: '50px',
		text:'Logar',
		formBind: true,
		disabled: true,
		handler: function() {
			var form = this.up('form').getForm();
			if(form.isValid()) {
                form.submit({
                	waitMsg: 'Verificando dados, aguarde!',
                    success: function(form, action) {
                    	Ext.Msg.alert('Success', 'Logado!');
                    },
                    failure: function(form, action) {
                        Ext.Msg.alert('Atencao!', action.result.motivo);
                    }
                });
			} else {
				Ext.Msg.alert('Atencao!', 'Dados invalidos!');
			}
		}
	}]
});